-- 不可烹饪的食物获取后在烹饪指南中显示解锁
local foods = require("tf_foods")
local cooking = require("cooking")
AddSimPostInit(function()
    if TheCookbook then
        for k, v in pairs(foods) do
            if v.unlock and not TheCookbook:IsUnlocked(k) then
                TheCookbook:AddRecipe(k, v.unlock)
            end
        end
    end
end)

-- 料理
for k, recipe in pairs(foods) do
    if TUNING.TF_COOK == "all" then
        AddCookerRecipe("cookpot", recipe)         -- 烹饪锅
        AddCookerRecipe("archive_cookpot", recipe) -- 档案馆远古窑,有好多mod作者忽略了这口锅
    end
    AddCookerRecipe("portablecookpot", recipe)     -- 便携式烹饪锅

    if recipe.card_def then
        AddRecipeCard("cookpot", recipe) -- 食谱卡
    end
end

-- 兼容调味粉
GenerateSpicedFoods(require("tf_foods"))
local spicedfoods = require("spicedfoods")
for k, recipe in pairs(spicedfoods) do
    if recipe.mod and recipe.mod == "tf" then
        recipe.official = false
        AddCookerRecipe("portablespicer", recipe)
    end
end

-- 添加食材可入锅
AddIngredientValues({ "tf_crab" }, { meat = .5, fish = 1 })                     -- 淡水蟹
AddIngredientValues({ "tf_dead_crab" }, { meat = .5, fish = 1 })                -- 死蟹
AddIngredientValues({ "tf_dead_crab_cooked" }, { meat = .5, fish = 1 })         -- 熟蟹
AddIngredientValues({ "tf_green_shrimp" }, { meat = .5, fish = 1 })             -- 淡水虾
AddIngredientValues({ "tf_green_shrimp_meat" }, { meat = .5, fish = 1 })        -- 虾仁
AddIngredientValues({ "tf_green_shrimp_meat_cooked" }, { meat = .5, fish = 1 }) -- 熟虾仁
AddIngredientValues({ "tf_orange" }, { fruit = 1 }, true)                       -- 橘子
AddIngredientValues({ "tf_cabbage" }, { veggie = 1 }, true)                     -- 白菜
AddIngredientValues({ "tf_green_pepper" }, { veggie = 1 }, true)                -- 青椒
AddIngredientValues({ "tf_strawberry" }, { fruit = 1 }, true)                   -- 草莓
AddIngredientValues({ "tf_bacon" }, { meat = .5 })                              -- 培根
AddIngredientValues({ "tf_milk" }, { sweetener = .5, dairy = 1, fat = 1 })      -- 牛奶
AddIngredientValues({ "tf_kimchi" }, { veggie = 1.5, decoration = 1 })          -- 泡菜

-- 以下是原版食材,需要确认其他mod是否有添加,避免覆盖
-- 蕨叶
local ingredients = cooking.ingredients
if ingredients.foliage == nil then
    AddIngredientValues({ "foliage" }, { tffood = 1 })
else
    ingredients.foliage.tags.tffood = 1
end

-- 松果--联动
if ingredients.pinecone == nil then
    AddIngredientValues({ "pinecone" }, { tffood = 1 })
else
    ingredients.pinecone.tags.tffood = 1
end
